import { ref } from 'vue'
import { defineStore } from 'pinia'


export const useUserData = defineStore('userdata', () => {

    const userList = ref(
        [
            {
                name: 'zhangsan',
                password: '123',
                id: '000001',
                imgUrl: 'http://www.dell-lee.com/imgs/vue3/orange.png',
                list: [
                    { title: '红包', content: 218 },
                    { title: '优惠劵', content: '12张' },
                    { title: '红豆', content: 88 },
                    { title: '白条', content: 1000 }
                ],
                addressList: [
                    {
                        name: '小慕',
                        phone: 18611111111,
                        address_text: '北京 海淀区西三环北路2号院北京理工大学国防科技园2号楼10号'
                    },
                    {
                        name: '小可',
                        phone: 18622222222,
                        address_text: '北京 朝阳区北京工业大学3号楼303'
                    }
                ],
                currentAddress: null
            },
            {
                name: 'admin',
                password: '123',
                id: '000002',
                imgUrl: 'http://www.dell-lee.com/imgs/vue3/orange.png',
                list: [
                    { title: '红包', content: 22 },
                    { title: '优惠劵', content: '7张' },
                    { title: '红豆', content: 120 },
                    { title: '白条', content: 2000 }
                ],
                addressList: [],
                currrentAddress: null
            }
        ]
    )
    // const action = (item) => {
    //     console.log(item);
    //     return userList.value.currrentAddress =  item
    // }
    const currentUserInfo = userList.value[0]
    return { userList, currentUserInfo }
})